package org.business.accounting.beans;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import org.business.accounting.interfaces.BasicOrder;
import org.business.accounting.interfaces.Computer;
import org.business.accounting.interfaces.ComputerOrder;

public class ComputerBean extends BasicProductBean implements Computer {

	private double processorSpeed;
	private String graphicCard;
	private String chipset;
	private double ramMB;

	private List<ComputerOrder> orderList;

	public ComputerBean() {
		orderList = new Vector<ComputerOrder>();
	}
	
	public ComputerBean clone() {
		ComputerBean computerBean = new ComputerBean();
		computerBean.setAmount(getAmount());
		computerBean.setChipset(getChipset());
		computerBean.setGraphicCard(getGraphicCard());
		computerBean.setName(getName());
		computerBean.setPrice(getPrice());
		computerBean.setProcessorSpeed(getProcessorSpeed());
		computerBean.setRamMB(getRamMB());
		
		return computerBean;
	}

	public void add(BasicOrder basicOrder) {
		orderList.add((ComputerOrder) basicOrder);
	}

	public List<BasicOrder> getOrderList() {
		List<BasicOrder> list = new Vector<BasicOrder>();
		Iterator<ComputerOrder> iterator = orderList.iterator();
		BasicOrder basicOrder;
		while (iterator.hasNext()) {
			basicOrder = iterator.next();
			list.add(basicOrder);
		}
		return list;
	}

	public void setOrderList(List<BasicOrder> orderList) {
		Iterator<BasicOrder> iterator = orderList.iterator();
		ComputerOrder computerOrder;
		while (iterator.hasNext()) {
			computerOrder = (ComputerOrder) iterator.next();
			this.orderList.add(computerOrder);
		}
	}

	public double getProcessorSpeed() {
		return processorSpeed;
	}

	public void setProcessorSpeed(double processorSpeed) {
		this.processorSpeed = processorSpeed;
	}

	public String getGraphicCard() {
		return graphicCard;
	}

	public void setGraphicCard(String graphicCard) {
		this.graphicCard = graphicCard;
	}

	public String getChipset() {
		return chipset;
	}

	public void setChipset(String chipset) {
		this.chipset = chipset;
	}

	public double getRamMB() {
		return ramMB;
	}

	public void setRamMB(double ramMB) {
		this.ramMB = ramMB;
	}

}
